package com.lry.crawlers.fiction.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lry.crawlers.fiction.entity.FictionUpdate;
import com.lry.crawlers.fiction.mapper.FictionUpdateMapper;
import com.lry.crawlers.fiction.service.FictionUpdateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FictionUpdateServiceImpl implements FictionUpdateService {
    @Autowired
    FictionUpdateMapper fictionUpdateMapper;

    @Override
    public int setFictionUpdate(FictionUpdate fictionUpdate) {
        return fictionUpdateMapper.insert(fictionUpdate);
    }

    @Override
    public List<FictionUpdate> getFictionUpdates() {
        return fictionUpdateMapper.selectList(null);
    }

    @Override
    public int setFictionUpdateUp(FictionUpdate fictionUpdate) {
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("fiction_id",fictionUpdate.getFictionId());
        return fictionUpdateMapper.update(fictionUpdate,wrapper);
    }



}
